 "app"
 "ui"
 /**
 * 配置
 */
 const { url, device_id, deviceWidth, deviceHeight, randomSleep, deleteDirCache, 
    waitForAndClick, waitForAndSetText, exitAppAndJs, httpUploadErrMsg
} = require("/sdcard/Download/js/config.js");
try{
    
    // 发送成功绑定
    log("/device/upload/status" + device_id)
    var res = httpPostData_JSON("/device/upload/bindStatus", {
        deviceId: device_id,
        status: 1
    }) 
    log(res)


    
}catch(e){
    alert("绑定失败！: "+e)
    httpUploadErrMsg("脚本执行错误：绑定脚本"+" => "+e)
}

/**
     * @description 进行post请求服务器
     * @param {string} urlPath 请求路径
     * @param {json} uploadData 必须是json格式的数据
     */
function httpPostData_JSON (urlPath, uploadData){
    // 如果uploadData不为null，则添加deviceId
    if(uploadData != null){
        uploadData.deviceId = device_id
    }else{
        uploadData = {
            "deviceId": device_id
        }
    }
    var res = http.post(url+urlPath,uploadData);
    return res.body.json();
}